<?php

class Application_Model_service_MailService {
	
	protected static $_instance=null;
	
	protected function __construct(){
			
	}
	public static function getInstance(){
		if(self::$_instance==null) {
			self::$_instance = new self();
		date_default_timezone_set('Asia/Krasnoyarsk');
			require_once 'Zend/Mail.php';
			require_once 'Zend/Mail/Transport/Smtp.php';
			try {
			$config = array('auth' => 'login',
			'username' => 'nguyen.haidangday',
			'password' => 'dangybxl','port' => 25,
			'ssl' => 'tls'
			);
			$mailTransport = new Zend_Mail_Transport_Smtp('smtp.gmail.com',$config) ;
			Zend_Mail::setDefaultTransport($mailTransport);
			
			
			} catch (Zend_Exception $e) {
//					echo $e->getMessage();
			}
		
		
		
		
		}
		return self::$_instance;
	}
	public function autosend($to,$message){
			
				
		$mail = new Zend_Mail();
		$mail->setFrom('nguyen.haidangday@gmail.com', 'Administrator');
		
		$mail->setBodyText($message);
		$mail->addTo($to, 'Custommer');
		$mail->setSubject('AuTo Send');
		try{
		$mail->send(); 
		}catch (Zend_Exception $e) {
//				echo $e->getMessage()."ERRRRR";
		}
		
	}
	public function manualsend(){
		
	}
}

?>